<template>
  <ul class="sticky-shared" :class="{ active }">
    <li>
      <span></span>
      <em></em>
      <em></em>
      <em></em>
      <div class="avatar">
        <img src="../../../assets/images/home/shared01.png" alt="wife" />
      </div>
    </li>
    <li>
      <em></em>
      <em></em>
      <em></em>
      <div class="avatar">
        <img src="../../../assets/images/home/shared03.png" alt="wife" />
        <div class="talk">
          <img src="../../../assets/images/home/small.png" alt="wife" />
        </div>
      </div>
    </li>
    <li>
      <em></em>
      <em></em>
      <em></em>
      <div class="avatar">
        <img src="../../../assets/images/home/shared02.png" alt="husband" />
        <ol class="talk">
          <li v-for="item in 5" :key="item" />
        </ol>
      </div>
      <ul class="content">
        <li v-for="item in 5" :key="item" />
      </ul>
    </li>
  </ul>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'

const active = ref<boolean>(false)

onMounted(() => {
  setTimeout(() => {
    active.value = true
  })
})
</script>

<style scoped lang="scss">
@import '@/assets/scss/base.scss';

.sticky-shared {
  display: flex;
  height: 430px;
  position: absolute;
  right: 50px;
  justify-content: flex-end;
  align-items: center;

  &.active {
    > li {
      &:nth-of-type(2) > .avatar > .talk {
        transition: all 1s 0.9s;
        transform: scale(1) !important;
        opacity: 1 !important;
      }

      &:nth-of-type(3) > .avatar > .talk {
        transition: all 1s 0.3s;
        transform: translateX(0);
        opacity: 1;
      }

      &:nth-of-type(3) > .content {
        transition: all 1s 0.6s;
        transform: scale(1);
        opacity: 1;
      }
    }
  }

  > li {
    border-radius: 10px;
    box-sizing: border-box;
    position: relative;

    > em {
      margin-top: 16px;
      display: inline-block;
      height: 12px;
      border-radius: 6px;
    }

    > .avatar {
      border-radius: 50%;
      position: absolute;

      > img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
        object-fit: contain;
      }
    }

    &:nth-of-type(1) {
      margin-left: 46px;
      width: 238px;
      height: 305px;
      background: linear-gradient(180deg, #ddf3ff 0%, #ffffff 100%);
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      align-items: center;
      padding-bottom: 31px;

      > .avatar {
        width: 110px;
        height: 110px;
        left: -46px;
        top: -44px;
      }

      > span {
        margin-left: 94px;
        display: inline-block;
        width: 72px;
        height: 50px;
        background-color: #daeffa;
        border-radius: 4px;
      }

      > em {
        width: 170px;
        background-color: #daeffa;
      }
    }

    &:nth-of-type(2) {
      padding-top: 14px;
      margin: 0 20px;
      width: 174px;
      height: 411px;
      background: linear-gradient(180deg, #faeff0 0%, rgba(255, 255, 255, 0) 100%);

      > .avatar {
        width: 108px;
        height: 108px;
        right: -56px;
        bottom: -54px;

        > .talk {
          position: absolute;
          top: 20px;
          left: -38px;
          width: 62px;
          height: 39px;
          background: #ffffff;
          box-shadow: 15px 21px 70px 0 #0b0e10;
          border-radius: 10px 10px 0 10px;
          transform-origin: right bottom;
          transform: scale(0);
          opacity: 0;
          display: flex;
          justify-content: center;
          align-items: center;

          > img {
            height: 100%;
            object-fit: contain;
          }
        }
      }

      > em {
        margin-top: 12px;
        width: 120px;
        background-color: #fff;
        margin-left: 24px;

        &:nth-of-type(2) {
          width: 60px;
        }
      }
    }

    &:nth-of-type(3) {
      margin-top: 60px;
      width: 238px;
      height: 293px;
      background: linear-gradient(180deg, #fff2b1 0%, #ffffff 100%);
      box-sizing: border-box;
      padding-top: 40px;

      > .avatar {
        width: 88px;
        height: 88px;
        top: -50px;
        right: 21px;

        > .talk {
          position: absolute;
          top: 1px;
          left: -110px;
          width: 127px;
          height: 36px;
          background: #ffffff;
          box-shadow: 13px 19px 38px 0 rgba(84, 123, 57, 0.45);
          border-radius: 18px;
          padding-left: 20px;
          box-sizing: border-box;
          display: flex;
          align-items: center;
          transform-origin: right center;
          transform: translateX(30px);
          opacity: 0;

          > li {
            margin-right: 10px;
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background-color: #f6af32;
          }
        }
      }

      > .content {
        position: absolute;
        top: 44px;
        left: -117px;
        width: 141px;
        height: 80px;
        background: #ffffff;
        box-shadow: 15px 21px 70px 0 #b4ccd8;
        border-radius: 6px;
        padding: 17px 27px 10px 43px;
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        transform-origin: center bottom;
        transform: scaleY(0);
        opacity: 0;

        > li {
          width: 8px;
          height: 100%;
          background-color: #3078e9;
          border-radius: 5px;

          &:nth-of-type(1),
          &:nth-of-type(3) {
            height: 20px;
          }

          &:nth-of-type(2) {
            background-color: #d4e3fb;
          }

          &:nth-of-type(4) {
            height: 60%;
          }
        }
      }

      > em {
        margin-top: 12px;
        width: 162px;
        background-color: #fff;
        margin-left: 28px;

        &:nth-of-type(3) {
          width: 70px;
        }
      }
    }
  }
}
</style>
